<@pp.dropOutputFile />
<#list doc.beans.bean as bn>
<@pp.changeOutputFile name=bn.beanName?cap_first+"DaoJdbc.java" />

package ${doc.beans.@domain}.${doc.beans.@company}.${doc.beans.@project}.dao.jdbc;
 
import java.util.List;

import ${doc.beans.@domain}.${doc.beans.@company}.${doc.beans.@project}.dao.${bn.beanName?cap_first}Dao;
import com.tongji.quickCRUDQ.define.Row;
import com.tongji.quickCRUDQ.model.CommonBean;
import com.tongji.quickCRUDQ.dao.jdbc.BaseDaoJdbc;

public class ${bn.beanName?cap_first}DaoJdbc extends BaseDaoJdbc implements ${bn.beanName?cap_first}Dao {
	String tableName="${bn.tableName}";
	String beanName="${bn.beanName}";
	
	public CommonBean create${bn.beanName?cap_first}(){
		CommonBean ${bn.beanName}s=this.createBean(tableName,beanName);
                return ${bn.beanName}s;		
	}
	
/*
	public CommonBean find${bn.beanName?cap_first}s(String refid) {
		CommonBean ${bn.beanName}s=this.create${bn.beanName?cap_first}();
		String sql="select * from ${bn.tableName} where refid=?";
		List data=this.getCommonDao().select(sql,new String[]{refid});
		${bn.beanName}s.addData(data);
                return ${bn.beanName}s;
       }
*/
	public CommonBean find${bn.beanName?cap_first}ById(String id) {
		CommonBean ${bn.beanName}s=this.create${bn.beanName?cap_first}();
		String sql="select * from ${bn.tableName} where id=?";
		List data=this.getCommonDao().select(sql,new String[]{id});
		${bn.beanName}s.addData(data);
    return ${bn.beanName}s;
  }
  
	public CommonBean findAll${bn.beanName?cap_first}s() {
		CommonBean ${bn.beanName}s=this.create${bn.beanName?cap_first}();
		String sql="select * from ${bn.tableName} ";
		List data=this.getCommonDao().select(sql,new String[]{});
		${bn.beanName}s.addData(data);
    return ${bn.beanName}s;
  }
	public void insert${bn.beanName?cap_first}(CommonBean ${bn.beanName}Bean){
		List data=${bn.beanName}Bean.getData();
		Row row=this.getRow(tableName);
		this.getCommonDao().templateBatchInsert(row,data,this.getIdGenerator());
	}
	public void update${bn.beanName?cap_first}(CommonBean ${bn.beanName}Bean){
		List data=${bn.beanName}Bean.getData();
		Row row=this.getRow(tableName);
		this.getCommonDao().templateBatchUpdate(row,data);
	}
}

</#list>
